package subject_set.lanqiao;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author haomin
 * @date 2022/10/25 17:26
 **/
public class Num6 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] data = new int[10];
        Arrays.fill(data, 2021);
        int num = 1;
        boolean f = true;
        while(true){
            int tem = num;
            while(tem != 0){
                int ind = (tem % 10);
                data[ind]--;
                if(data[ind] == -1) f = false;
                tem /= 10;
            }
            if(!f) break;
            num++;
        }
        System.out.println(num-1);
        scan.close();
    }
}